// $ANTLR 3.4 C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g 2012-11-07 16:34:58

  package practica8;
  import java.util.Hashtable;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;

@SuppressWarnings({"all", "warnings", "unchecked"})
public class BreakParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "BLANCO", "BREAK", "COMA", "DIGITO", "IDENT", "IF", "LETRA", "LLAVE_A", "LLAVE_C", "NUMERO", "PARENTESIS_A", "PARENTESIS_C", "PUNTO_COMA", "VOID", "WHILE"
    };

    public static final int EOF=-1;
    public static final int BLANCO=4;
    public static final int BREAK=5;
    public static final int COMA=6;
    public static final int DIGITO=7;
    public static final int IDENT=8;
    public static final int IF=9;
    public static final int LETRA=10;
    public static final int LLAVE_A=11;
    public static final int LLAVE_C=12;
    public static final int NUMERO=13;
    public static final int PARENTESIS_A=14;
    public static final int PARENTESIS_C=15;
    public static final int PUNTO_COMA=16;
    public static final int VOID=17;
    public static final int WHILE=18;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public BreakParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public BreakParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

    public String[] getTokenNames() { return BreakParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g"; }


        
        private ArrayList<RecognitionException> errors = new ArrayList<RecognitionException>();
        public ArrayList<RecognitionException> getErrors() {
           return errors;
        }
        @Override
        public void reportError (RecognitionException e) {
           String msg = getErrorMessage(e, getTokenNames());
           System.err.println(msg);
           errors.add(e);
        }



    // $ANTLR start "entrada"
    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:29:1: entrada[boolean cond_while] : ( bucle_while[cond_while] | condicional_if[cond_while] )* ;
    public final void entrada(boolean cond_while) throws RecognitionException {
        try {
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:29:29: ( ( bucle_while[cond_while] | condicional_if[cond_while] )* )
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:29:31: ( bucle_while[cond_while] | condicional_if[cond_while] )*
            {
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:29:31: ( bucle_while[cond_while] | condicional_if[cond_while] )*
            loop1:
            do {
                int alt1=3;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==WHILE) ) {
                    alt1=1;
                }
                else if ( (LA1_0==IF) ) {
                    alt1=2;
                }


                switch (alt1) {
            	case 1 :
            	    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:29:32: bucle_while[cond_while]
            	    {
            	    pushFollow(FOLLOW_bucle_while_in_entrada59);
            	    bucle_while(cond_while);

            	    state._fsp--;
            	    if (state.failed) return ;

            	    }
            	    break;
            	case 2 :
            	    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:29:56: condicional_if[cond_while]
            	    {
            	    pushFollow(FOLLOW_condicional_if_in_entrada62);
            	    condicional_if(cond_while);

            	    state._fsp--;
            	    if (state.failed) return ;

            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "entrada"



    // $ANTLR start "bucle_while"
    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:31:1: bucle_while[boolean cond_while] : w= WHILE c= condicion b= bloque[true] ;
    public final void bucle_while(boolean cond_while) throws RecognitionException {
        Token w=null;

        try {
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:31:33: (w= WHILE c= condicion b= bloque[true] )
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:31:35: w= WHILE c= condicion b= bloque[true]
            {
            w=(Token)match(input,WHILE,FOLLOW_WHILE_in_bucle_while76); if (state.failed) return ;

            pushFollow(FOLLOW_condicion_in_bucle_while80);
            condicion();

            state._fsp--;
            if (state.failed) return ;

            pushFollow(FOLLOW_bloque_in_bucle_while84);
            bloque(true);

            state._fsp--;
            if (state.failed) return ;

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "bucle_while"



    // $ANTLR start "condicional_if"
    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:33:1: condicional_if[boolean cond_while] : i= IF c= condicion b= bloque[cond_while] ;
    public final void condicional_if(boolean cond_while) throws RecognitionException {
        Token i=null;

        try {
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:33:36: (i= IF c= condicion b= bloque[cond_while] )
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:33:38: i= IF c= condicion b= bloque[cond_while]
            {
            i=(Token)match(input,IF,FOLLOW_IF_in_condicional_if96); if (state.failed) return ;

            pushFollow(FOLLOW_condicion_in_condicional_if100);
            condicion();

            state._fsp--;
            if (state.failed) return ;

            pushFollow(FOLLOW_bloque_in_condicional_if104);
            bloque(cond_while);

            state._fsp--;
            if (state.failed) return ;

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "condicional_if"



    // $ANTLR start "condicion"
    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:35:1: condicion : PARENTESIS_A IDENT PARENTESIS_C ;
    public final void condicion() throws RecognitionException {
        try {
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:35:10: ( PARENTESIS_A IDENT PARENTESIS_C )
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:35:12: PARENTESIS_A IDENT PARENTESIS_C
            {
            match(input,PARENTESIS_A,FOLLOW_PARENTESIS_A_in_condicion112); if (state.failed) return ;

            match(input,IDENT,FOLLOW_IDENT_in_condicion114); if (state.failed) return ;

            match(input,PARENTESIS_C,FOLLOW_PARENTESIS_C_in_condicion116); if (state.failed) return ;

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "condicion"



    // $ANTLR start "bloque"
    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:37:1: bloque[boolean cond_while] : LLAVE_A ( sentencias[cond_while] )* LLAVE_C ;
    public final void bloque(boolean cond_while) throws RecognitionException {
        try {
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:37:28: ( LLAVE_A ( sentencias[cond_while] )* LLAVE_C )
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:37:30: LLAVE_A ( sentencias[cond_while] )* LLAVE_C
            {
            match(input,LLAVE_A,FOLLOW_LLAVE_A_in_bloque125); if (state.failed) return ;

            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:37:38: ( sentencias[cond_while] )*
            loop2:
            do {
                int alt2=2;
                int LA2_0 = input.LA(1);

                if ( (LA2_0==BREAK||LA2_0==IF||LA2_0==WHILE) ) {
                    alt2=1;
                }


                switch (alt2) {
            	case 1 :
            	    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:37:39: sentencias[cond_while]
            	    {
            	    pushFollow(FOLLOW_sentencias_in_bloque128);
            	    sentencias(cond_while);

            	    state._fsp--;
            	    if (state.failed) return ;

            	    }
            	    break;

            	default :
            	    break loop2;
                }
            } while (true);


            match(input,LLAVE_C,FOLLOW_LLAVE_C_in_bloque133); if (state.failed) return ;

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "bloque"



    // $ANTLR start "sentencias"
    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:39:1: sentencias[boolean cond_while] : ( bucle_while[cond_while] | condicional_if[cond_while] | salir[cond_while] );
    public final void sentencias(boolean cond_while) throws RecognitionException {
        try {
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:39:32: ( bucle_while[cond_while] | condicional_if[cond_while] | salir[cond_while] )
            int alt3=3;
            switch ( input.LA(1) ) {
            case WHILE:
                {
                alt3=1;
                }
                break;
            case IF:
                {
                alt3=2;
                }
                break;
            case BREAK:
                {
                alt3=3;
                }
                break;
            default:
                if (state.backtracking>0) {state.failed=true; return ;}
                NoViableAltException nvae =
                    new NoViableAltException("", 3, 0, input);

                throw nvae;

            }

            switch (alt3) {
                case 1 :
                    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:39:34: bucle_while[cond_while]
                    {
                    pushFollow(FOLLOW_bucle_while_in_sentencias142);
                    bucle_while(cond_while);

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 2 :
                    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:39:60: condicional_if[cond_while]
                    {
                    pushFollow(FOLLOW_condicional_if_in_sentencias147);
                    condicional_if(cond_while);

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;
                case 3 :
                    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:39:89: salir[cond_while]
                    {
                    pushFollow(FOLLOW_salir_in_sentencias152);
                    salir(cond_while);

                    state._fsp--;
                    if (state.failed) return ;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "sentencias"



    // $ANTLR start "salir"
    // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:41:1: salir[boolean cond_while] : BREAK PUNTO_COMA ;
    public final void salir(boolean cond_while) throws RecognitionException {
        try {
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:41:27: ( BREAK PUNTO_COMA )
            // C:\\Users\\usuario\\workspace\\Practica8-PL\\src\\main\\java\\practica8\\BreakParser.g:41:29: BREAK PUNTO_COMA
            {
            match(input,BREAK,FOLLOW_BREAK_in_salir162); if (state.failed) return ;

            match(input,PUNTO_COMA,FOLLOW_PUNTO_COMA_in_salir164); if (state.failed) return ;

            if ( state.backtracking==0 ) {if (cond_while)
                                                             System.out.println("Instruccion break ubicada dentro de bucle While");
                                                          else
                                                             System.out.println("Instruccion break ubicada fuera de bucle While");}

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "salir"

    // Delegated rules


 

    public static final BitSet FOLLOW_bucle_while_in_entrada59 = new BitSet(new long[]{0x0000000000040202L});
    public static final BitSet FOLLOW_condicional_if_in_entrada62 = new BitSet(new long[]{0x0000000000040202L});
    public static final BitSet FOLLOW_WHILE_in_bucle_while76 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_condicion_in_bucle_while80 = new BitSet(new long[]{0x0000000000000800L});
    public static final BitSet FOLLOW_bloque_in_bucle_while84 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_IF_in_condicional_if96 = new BitSet(new long[]{0x0000000000004000L});
    public static final BitSet FOLLOW_condicion_in_condicional_if100 = new BitSet(new long[]{0x0000000000000800L});
    public static final BitSet FOLLOW_bloque_in_condicional_if104 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_PARENTESIS_A_in_condicion112 = new BitSet(new long[]{0x0000000000000100L});
    public static final BitSet FOLLOW_IDENT_in_condicion114 = new BitSet(new long[]{0x0000000000008000L});
    public static final BitSet FOLLOW_PARENTESIS_C_in_condicion116 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_LLAVE_A_in_bloque125 = new BitSet(new long[]{0x0000000000041220L});
    public static final BitSet FOLLOW_sentencias_in_bloque128 = new BitSet(new long[]{0x0000000000041220L});
    public static final BitSet FOLLOW_LLAVE_C_in_bloque133 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_bucle_while_in_sentencias142 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_condicional_if_in_sentencias147 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_salir_in_sentencias152 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_BREAK_in_salir162 = new BitSet(new long[]{0x0000000000010000L});
    public static final BitSet FOLLOW_PUNTO_COMA_in_salir164 = new BitSet(new long[]{0x0000000000000002L});

}